package com.sykj.cloud.system.api.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sykj.cloud.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 系统角色对象 sys_roles
 *
 * @author mr.will
 * @date 2021-03-17
 */
public class SysRole extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** ID */
    private String guid;

    /** 应用ID */
    private String applicationId;

    /** 组织机构ID */

    private String organizationId;

    /** 系统定义ID */

    private String systemDefineId;

    /** 公司业务分类 */

    private String businessCategoryId;

    /** 部门ID */

    private String deptId;

    /** 角色名称 */

    private String name;

    /** 简称 */

    private String shortName;

    /** 角色类型 */

    private Integer roleType;

    /** 上级ID */

    private String parentId;

    /** 是否默认 */

    private Integer defaultRole;

    /** 是否有效 */

    private Integer valid;

    /** 是否锁定 */

    private Integer lock;

    /** 是否删除 */

    private Integer deleted;

    /** 删除人 */

    private String deleteBy;

    /** 删除时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date deleteTime;

    /** 角色权限字符串 */

    private String roleKey;

    /** 数据范围 */

    private Integer dataScope;

    /** 菜单树选择项是否关联显示 */
    private boolean menuCheckStrictly;

    /** 部门树选择项是否关联显示 */
    private boolean deptCheckStrictly;

    /** 描述 */
    private String description;

    /** 显示排序号 */
    private Integer orderSeq;

    /** 菜单组 */
    private String[] menuIds;

    /** 部门组（数据权限） */
    private String[] deptIds;


    public boolean isAdmin()
    {
        return isAdmin(this.guid);
    }

    public static boolean isAdmin(String roleId)
    {
        return roleId != null && "" == roleId;
    }

    public String[] getMenuIds() {
        return menuIds;
    }

    public Integer getOrderSeq() {
        return orderSeq;
    }

    public String getGuid() {
        return guid;
    }

    public void setGuid(String guid) {
        this.guid = guid;
    }

    public String getApplicationId() {
        return applicationId;
    }

    public void setApplicationId(String applicationId) {
        this.applicationId = applicationId;
    }

    public String getOrganizationId() {
        return organizationId;
    }

    public void setOrganizationId(String organizationId) {
        this.organizationId = organizationId;
    }

    public String getSystemDefineId() {
        return systemDefineId;
    }

    public void setSystemDefineId(String systemDefineId) {
        this.systemDefineId = systemDefineId;
    }

    public String getBusinessCategoryId() {
        return businessCategoryId;
    }

    public void setBusinessCategoryId(String businessCategoryId) {
        this.businessCategoryId = businessCategoryId;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public Integer getRoleType() {
        return roleType;
    }

    public void setRoleType(Integer roleType) {
        this.roleType = roleType;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public Integer getDefaultRole() {
        return defaultRole;
    }

    public void setDefaultRole(Integer defaultRole) {
        this.defaultRole = defaultRole;
    }

    public Integer getValid() {
        return valid;
    }

    public void setValid(Integer valid) {
        this.valid = valid;
    }

    public Integer getLock() {
        return lock;
    }

    public void setLock(Integer lock) {
        this.lock = lock;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

    public String getDeleteBy() {
        return deleteBy;
    }

    public void setDeleteBy(String deleteBy) {
        this.deleteBy = deleteBy;
    }

    public Date getDeleteTime() {
        return deleteTime;
    }

    public void setDeleteTime(Date deleteTime) {
        this.deleteTime = deleteTime;
    }

    public String getRoleKey() {
        return roleKey;
    }

    public void setRoleKey(String roleKey) {
        this.roleKey = roleKey;
    }

    public Integer getDataScope() {
        return dataScope;
    }

    public void setDataScope(Integer dataScope) {
        this.dataScope = dataScope;
    }

    public boolean isMenuCheckStrictly() {
        return menuCheckStrictly;
    }

    public void setMenuCheckStrictly(boolean menuCheckStrictly) {
        this.menuCheckStrictly = menuCheckStrictly;
    }

    public boolean isDeptCheckStrictly() {
        return deptCheckStrictly;
    }

    public void setDeptCheckStrictly(boolean deptCheckStrictly) {
        this.deptCheckStrictly = deptCheckStrictly;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setOrderSeq(Integer orderSeq) {
        this.orderSeq = orderSeq;
    }

    public void setMenuIds(String[] menuIds) {
        this.menuIds = menuIds;
    }

    public String[] getDeptIds() {
        return deptIds;
    }

    public void setDeptIds(String[] deptIds) {
        this.deptIds = deptIds;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("guid", getGuid())
            .append("applicationId", getApplicationId())
            .append("organizationId", getOrganizationId())
            .append("systemDefineId", getSystemDefineId())
            .append("businessCategoryId", getBusinessCategoryId())
            .append("deptId", getDeptId())
            .append("name", getName())
            .append("shortName", getShortName())
            .append("roleType", getRoleType())
            .append("parentId", getParentId())
            .append("defaultRole", getDefaultRole())
            .append("valid", getValid())
            .append("lock", getLock())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("deleted", getDeleted())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("deleteBy", getDeleteBy())
            .append("deleteTime", getDeleteTime())
            .append("roleKey", getRoleKey())
            .append("dataScope", getDataScope())
            .append("menuCheckStrictly", isDeptCheckStrictly())
            .append("deptCheckStrictly", isMenuCheckStrictly())
            .append("orderSeq", getOrderSeq())
            .append("description", getDescription())
            .toString();
    }
}
